
init python in mystore:
    import os
    import requests
    print("123")
    serial_number = 0
    def getQuestion(ques):
        url = "http://localhost:8000/"
        json_data = {
            "prompt": ques,
            "history": [],
            "max_length": 2048,
            "top_p": 0.7,
            "temperature": 0.95
        }
        response = requests.post(url, json=json_data)
        if response.status_code == 200:
            data = response.json()
            if "response" in data:
                print(data["response"])
                ans=data["response"]
                return ans
            else:
                print("Response field not found in the JSON data.")
                return "Response field not found in the JSON data."
        else:
            print("API request failed")
            return "API request failed"


    def serial():
        global serial_number
        serial_number += 1
        return serial_number
#     def call_api():
#         url = "http://localhost:8081/renpy"
#         response = requests.post(url, json={"name": "John", "age": 30, "email": "john@example.com"})
#         data = response.json()
#         print("get connect")
#         print(data)
#         if response.status_code == 200:
#             if "message" in data and data["message"] == "Data processed successfully":
#                 return "success"
#             else:
#                 return "failure"
#         else:
#             return "API request failed"

default character_stats.chloe_substore.friends = {"Eileen",}

label QuestionPage:

    scene background
    # call screen mysc
    $ serial = mystore.serial()


    "What is the Question？"
    python:
        ques = renpy.input("What're the questions  name?")
    "The question is[ques]"
    $ ans=mystore.getQuestion(ques)



    "The ans is [ans]"
    if "Lucy" in character_stats.chloe_substore.friends:
        "露西是我的朋友！"
    elif character_stats.chloe_substore.friends:
        "我有很多朋友，但露西并不是其中之一!"

    python in character_stats.chloe_substore:
        friends.add("Jeremy")